package com.woniuxy.table.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.cloud.mall95.log.Log;
import com.woniuxy.table.client.TableTypeMannageClient;
import com.woniuxy.table.client.param.AddTableTypeParam;
import com.woniuxy.table.client.param.ModifyTableTypeParam;
import com.woniuxy.table.service.DinnerTableTypeService;
import com.woniuxy.table.service.param.AddTableTypeServiceParam;
import com.woniuxy.table.service.param.ModifyTableTypeServiceParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

@RestController
public class TableTypeMannageApiImpl implements TableTypeMannageClient {
    @Autowired
    private DinnerTableTypeService dinnerTableTypeService;
    @Log("添加餐桌类型")
    @Override
    public Result addTableType(AddTableTypeParam addTableTypeParam) {
        AddTableTypeServiceParam addTableTypeServiceParam = BeanUtil.toBean(addTableTypeParam, AddTableTypeServiceParam.class);
        dinnerTableTypeService.addTableType(addTableTypeServiceParam);
        return Result.success();
    }
    @Log("修改餐桌类型信息")
    @Override
    public Result modifyTableType(ModifyTableTypeParam modifyTableTypeParam) {
        ModifyTableTypeServiceParam modifyTableTypeServiceParam = BeanUtil.toBean(modifyTableTypeParam, ModifyTableTypeServiceParam.class);
        dinnerTableTypeService.modifyTableType(modifyTableTypeServiceParam);
        return Result.success();
    }
    @Log("删除餐桌类型")
    @Override
    public Result deleteTableType(Integer storeId, Integer tableTypeId) {
        dinnerTableTypeService.deleteTableType(storeId,tableTypeId);
        return Result.success();
    }
}
